package db.skywalker.callhelper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class DB
{
	private final String DB_NAME = "calling_helper.db3";
	private final int DB_VERSION = 1; 	
	private SQLiteDatabase db = null;
	private DbHelper dbHelper;
	
	public DB(Context context)
	{
		if (db == null)
		{
			Log.d("DB", "ready: new DbHelper(context, DB_NAME, null, DB_VERSION)");
			dbHelper = new DbHelper(context, DB_NAME, null, DB_VERSION);
			Log.d("DB", "new DbHelper(context, DB_NAME, null, DB_VERSION)");
			db = dbHelper.getWritableDatabase();
		}
	}
	
	public SQLiteDatabase open()
	{
		return db;
	}
	
	public void close()
	{
		if (db != null)
		{
			db.close();
		}
	}
}